<!DOCTYPE html>
<html lang="en">

    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子38-ES6/7常用语法介绍</title>
    </head>

    <body>
        <pre>
            <code>
                // 例子38

                // 字符串
                let str = 'hello';
                for(let s of str) {
                    console.log(s); // 前后分别输出"h" "e" "l" "l" "o"
                }

                //--------------------------------------------------------------------------

                // DOM NodeList对象
                let paras = document.querySelectorAll('p');
                for(let p of paras) {
                    p.classList.add('test');
                }

                //--------------------------------------------------------------------------

                // arguments对象
                function printArgs() {
                    for(let x of arguments) {
                        console.log(x);
                    }
                }
                printArgs('a', 'b'); // 前后分别输出"a" "b"
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/38.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>

</html>